﻿@model IEnumerable<FreightSoft.Models.CUSTOMER_ORDER>

@{
    ViewBag.Title = "Index";
}

<br />
<br />
<br />

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table class="table table-striped">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.ORDER_ID)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.CUSTOMER.NAME)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.WANTED_DELIVERY_DATE)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.DELIVERY_ADDRESS)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.STATUS)
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.ORDER_ID)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.CUSTOMER.NAME)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.WANTED_DELIVERY_DATE)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.DELIVERY_ADDRESS)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.STATUS)
        </td>
        <td>
            @if (item.STATUS.Equals("Planned"))
            {
            @Html.ActionLink("Edit |", "Edit", new { id=item.ORDER_ID  })
            }
            @Html.ActionLink(" Details", "Index", "OrderLine", new { id=item.ORDER_ID}, null)
        </td>
    </tr>
}

</table>
